/*=+--+=#=+--     Unmanned Aerial System Management Software      --+=#=+--+=#*\
|          Copyright (C) 2011 Regents of the University of Colorado.           |
|                             All Rights Reserved.                             |

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2 as
     published by the Free Software Foundation.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.

            Jack Elston                       Cory Dixon                        
|           elstonj@colorado.edu              dixonc@colorado.edu              |
|                                                                              |
\*=+--+=#=+--                 --+=#=+--+=#=+--                    --+=#=+--+=#*/

/*!
	\file nodeList.h
	\author Cory Dixon
*/

#ifndef __NODE_LIST_H
#define __NODE_LIST_H

#include <gtk/gtk.h>
#include "type_defs.h"

class NodeList
{
	private:
		bool           node_timedout[MAX_CLIENTS];

		GtkWidget    * node_list;
		GtkTreeStore * tree_model;
		GtkTreeView  * treeview;

		void format_treeview(); // this formats the columns

		static void streamSubscription(String name, uint8_t cmd_id, int onOff);
		static void item_toggled(GtkCellRendererToggle *cell, gchar *path_str, gpointer data);

	public:
		NodeList();
		~NodeList();

		void init();
		void refreshNodes();
		void addNodes();        // search for new nodes

		// use this function to indicate a command or ACK has been received
		void setCMD_RX(String name, uint8_t cmd_id, int ack_nack=-1); 

		// called by g timer, calls refreshNodes
		static gboolean timeout_cb(gpointer user_data);
};

#endif
